main(n,i,a,b,c,d,x,y){for(gets(&n);~scanf("%d",&n);printf("%d/%d\n",x/d,y/d)){for(x=0,y=1;n--;x=x*b+y*a,y*=b)scanf("%d%d",&a,&b);c=x<y?x:y;d=x>y?x:y;while(c)a=d%c,d=c,c=a;}}
